package com.xpec.cipher.tals.record;

import com.xpec.cipher.tals.TalsConstance;

/**
 * Client 用來送給 Server 的第一包 (使用 cipher的情況下)
 * @author linyuntai
 */
public class ClientHelloRecord extends HandShakeRecord{
	public byte[] data;

	public ClientHelloRecord(byte[] data) {
		this.data = data;
	}

	@Override
	protected int getContentLengthWithoutHandShakeTypeSize() {
		return TalsConstance.CLIENT_HELLO_SIZE;
	}

	@Override
	protected byte getHandShakeType() {
		return TalsConstance.HAND_SHAKE_TYPE_CLIENT_HELLO;
	}

	@Override
	protected byte[] resolveSubStructWithoutHandShakeType() {
		byte[] buffer = new byte[TalsConstance.CLIENT_HELLO_SIZE];
		System.arraycopy(data, 0, buffer, 0, TalsConstance.CLIENT_HELLO_SIZE);
		return buffer;		
	}
}
